package cn.initcap.designpattern.pattern.creational.prototype.copyconstructor;

import java.util.Date;

/**
 * @author initcap
 * @date Created in 3/17/19 8:39 PM.
 */
public class Test {

    private static final int CREATED_SIZE = 10;

    public static void main(String[] args) {
        Superme superme = new Superme();
        superme.setName("initcap");
        superme.setAge(26);
        superme.setBrithday(new Date());
        superme.setContent("通用的介绍，用于原型模式中所有需要拷贝的对象通用的字段；");
        for (int i = 0; i < CREATED_SIZE; i++) {
            Superme me = new Superme(superme);
            me.setName("initcap:" + i);
            me.setAge(i);
            long timestamp = 1332432324324L + i * 10000000000L;
            me.setBrithday(new Date(timestamp));
            System.out.println("克隆的第" + i + "个Superme: " + me);
        }
        System.out.println(superme);
    }

}
